# coding: utf-8
from enum import Enum

from PIL.ImageQt import QPixmap
from PyQt6.QtCore import Qt, QSize
from qfluentwidgets import FluentIconBase, getIconColor, Theme
from .settings import RESOURCES_DIR

resources = RESOURCES_DIR.as_posix()


class Icon(FluentIconBase, Enum):
    GRID = "Grid"
    MENU = "Menu"
    TEXT = "Text"
    PRICE = "Price"
    EMOJI_TAB_SYMBOLS = "EmojiTabSymbols"
    FPS = "Fps"
    PHOTO_ZIP = "PhotoZip"
    DATABASE = "Database"
    EXCEL = "Excel"
    WORD = "Word"
    PDF = "PDF"
    ZIP = "Zip"
    TRANSLATE = "Translate"
    BATCH = "Batch"
    HOME = 'Home'
    NEXT = 'Next'
    PREVIOUS = 'Previous'

    def path(self, theme=Theme.AUTO):
        return f"{resources}/images/icons/{self.value}_{getIconColor(theme)}.svg"


class SingleIcon(FluentIconBase, Enum):
    LOGO = 'logo.png'
    HEADER = 'header.png'
    HEADER1 = 'header1.png'
    DEL_FOLDER = 'del_folder.svg'
    VIDEO_COMPRESSION = 'VideoCompression.svg'
    FFmpeg = 'FFmpeg.svg'
    FALSE = "False.png"
    M3U8 = "m3u8.svg"
    VIDEO = "Video.svg"
    OTHER = "Other.svg"
    VIDEO_BG = "VideoBg.jpg"
    CONVERSION = "Conversion.svg"
    UPLOAD = "Upload.svg"

    def path(self, theme=Theme.AUTO):
        return f"{resources}/images/singles/{self.value}"

    def pixmap(self):
        return QPixmap(self.path())

    def image(self):
        return self.pixmap().toImage()


class OfficeIcon(FluentIconBase, Enum):
    ACCESS = 'access'
    COMPRESSED_FILE = 'compressed_file'
    CSV = 'csv'
    DATA = 'data'
    DATA1 = 'data1'
    DIR = 'dir'
    DOCUMENT = 'document'
    EMAIL = 'email'
    EML = 'eml'
    EXCEL = 'excel'
    EXCEL2 = 'excel2'
    EXCEL3 = 'excel3'
    EXCEL4 = 'excel4'
    EXCEL5 = 'excel5'
    FAVORITES = 'favorites'
    FUNDS = 'funds'
    GIF = 'gif'
    HOME = 'home'
    IMG = 'img'
    JPG = 'jpg'
    LOGO = 'logo'
    NEW_FILE = 'new_file'
    NEW_FILE2 = 'new_file2'
    OUTLOOK = 'outlook'
    PDF = 'pdf'
    PDF2 = 'pdf2'
    PDF3 = 'pdf3'
    PDF4 = 'pdf4'
    PDF5 = 'pdf5'
    PDF_TO_PPT = 'pdf_to_ppt'
    PHONE = 'phone'
    PICTURE = 'picture'
    PNG = 'png'
    PPT = 'ppt'
    PPT2 = 'ppt2'
    PPT3 = 'ppt3'
    PPT4 = 'ppt4'
    PWD_DICT = 'pwd_dict'
    SHP = 'shp'
    SHP1 = 'shp1'
    TEXT = 'text'
    TXT = 'txt'
    UNKNOWN = 'unknown'
    UNKNOWN2 = 'unknown2'
    UNKNOWN3 = 'unknown3'
    VIDEO = 'video'
    WORD = 'word'
    WORD2 = 'word2'
    WORD3 = 'word3'
    WORD4 = 'word4'
    WORD5 = 'word5'
    ZIP = 'zip'
    IMG1 = 'img1'
    MARK = 'mark'
    UPLOAD = 'upload'

    def path(self, theme=Theme.AUTO):
        return f"{resources}/images/office/{self.value}"


class FileTypeIcon(FluentIconBase, Enum):
    AAC = 'AAC'
    AVI = 'AVI'
    CDR = 'CDR'
    CSS = 'CSS'
    CSV = 'CSV'
    DLL = 'DLL'
    DOC = 'DOC'
    EPS = 'EPS'
    FLV = 'FLV'
    GIF = 'GIF'
    HTML = 'HTML'
    ISO = 'ISO'
    JAR = 'JAR'
    JS = 'JS'
    JSON = 'JSON'
    MOV = 'MOV'
    MP3 = 'MP3'
    PDF = 'PDF'
    PHP = 'PHP'
    PPT = 'PPT'
    PSD = 'PSD'
    SQL = 'SQL'
    SVG = 'SVG'
    TTF = 'TTF'
    TXT = 'TXT'
    XLS = 'XLS'

    def path(self, theme=Theme.AUTO):
        return f"{resources}/images/files/{self.value}.svg"